package uk.ac.ebi.uniprot.wikipedia.entryProcessing;

import org.json.JSONException;
import uk.ac.ebi.uniprot.wikipedia.beanServices.SpringContextLoader;
import uk.ac.ebi.uniprot.wikipedia.exceptions.NoSuchOrganismException;
import uk.ac.ebi.uniprot.wikipedia.exceptions.ServiceException;
import uk.ac.ebi.uniprot.wikipedia.retrievalServices.GeneWikiRetrieval;
import uk.ac.ebi.uniprot.wikipedia.retrievalServices.UniProtRetrievalImpl;
import uk.ac.ebi.uniprot.wikipedia.util.GeneWikiOrganism;

import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * User: ljgarcia
 * Date: 30/07/12
 * Time: 16:44
 * To change this template use File | Settings | File Templates.
 */
public class GeneWikiXRefHumanConverter extends GeneWikiXRefConverter {
    /**
     * Bean initialization.
     * @throws IOException
     * @throws JSONException
     * @throws ServiceException
     */
    public void init () throws IOException, JSONException, ServiceException {
        this.setOrganism();
        super.init();
    }

    /**
     * Bean destroyer.
     */
    public void destroy() {
        super.destroy();
    }

    /**
     * Sets organism to HUMAN
     * @throws ServiceException
     */
    public void setOrganism() {
        super.setOrganism(GeneWikiOrganism.HUMAN);
    }

    /**
     * Sets bean property uniProtRetrievalService.
     * @param uniProtRetrievalService
     */
    public void setUniProtRetrievalService(UniProtRetrievalImpl uniProtRetrievalService) {
        super.setUniProtRetrievalService(uniProtRetrievalService);
    }

    /**
     * Sets bean property genewikiRetrieval.
     * @param
     */
    public void setGenewikiRetrieval(GeneWikiRetrieval genewikiRetrieval) {
        super.setGenewikiRetrieval(genewikiRetrieval);
    }

    public static void main(String[] args) throws ServiceException, IOException, JSONException, NoSuchOrganismException {
        GeneWikiXRefConverter converter = (GeneWikiXRefConverter) SpringContextLoader.getInstance().getBean("genewikiHumanXRef");
        System.out.println("GW no accession " + converter.genewikiRetrieval.getGeneWikiNoAccession().size());
        System.out.println("GW accession " + converter.genewikiRetrieval.getGeneWikiWithAccession().size());
        System.out.println("Missing accession " + converter.getMissingReviewedAccession().size());
        System.out.println("Non reviewed " + converter.getNotReviewedAccession().size());
        System.out.println("No gene in UP " + converter.getNoGeneForAccession().size());
        System.out.println("No matching gene in UP " + converter.getWrongGeneForAccession().size());
        System.out.println("Wrong organism " + converter.getWrongOrganismForAccession().size());
        System.out.println("No organism " + converter.getUndefinedOrganismForAccession().size());
        System.out.println("Unexpected error " + converter.getUnexpectedError().size());
        System.out.println("Candidates " + converter.getMatchingGeneWikiEntries().size());
        System.out.println("END");
    }
}
